import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
import { defineAsyncComponent } from "vue";
import Home from "../views/HomeViews.vue";
import Login from "../views/Login.vue";
import IamfeAll from "../views/International.vue";
import IamfeCh from "../views/Chinese.vue";
import News from "../views/activi/News.vue";
import Study from "../views/activi/Study.vue";
import CIFA from "../views/authentication/CIFA.vue";
import CWA from "../views/authentication/CWA.vue";
import Work from "../views/work/Index.vue";
import Reg from "../views/Reg.vue";
import ModifyPsd from "@/views/ModifyPsd.vue";
import NewDetailsVue from "@/views/activi/item/NewDetails.vue";
import StudyDetailsVue from "@/views/activi/item/StudyDetails.vue";
import CWADetailsVue from "@/views/exam/item/CWADetails.vue";
import CIFADetailsVue from "@/views/exam/item/CIFADetails.vue";
import Broadcast from "@/views/news/Index.vue"
import BroadcastItem from "@/views/news/item/BroadcastItem.vue";
import SearchVue from "@/views/search/Search.vue";
import AdminPrint from "@/views/personal_center/AdminPrint.vue";
import SearchTitleVue from "@/views/SearchTitle.vue";
const userInfo = () => import(`../views/personal_center/Index.vue`);
const cifaExamTrends = () => import(`../views/exam/CIFAExamTrends.vue`);
const cwaExamTrends = () => import(`../views/exam/CWAExamTrends.vue`);
const articleDetails = () => import(`../views/exam/item/CIFADetails.vue`);
const cwaExam = () => import(`../views/authentication/CWAExam.vue`);
const cifaExam = () => import(`../views/authentication/CIFAExam.vue`);
const studyForm =()=>import(`../views/activi/StudyForm.vue`);

 
 const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "home",
    component: Home,
  },
  {
    path: "/Login",
    name: "login",
    component: Login,
  },
  
  {
    path: "/chinese",
    name: "Iamfe_ch",
    component: IamfeCh,
  },
  {
    path: "/international",
    name: "Iamfe_all",
    component: IamfeAll,
  },
  {
    path: "/news",
    name: "news",
    component: News,
  },
  {
    path: "/study",
    name: "study",
    component: Study,
  },
  {
    path: "/cifa",
    name: "cifa",
    component: CIFA,
  },
  {
    path: "/reg",
    name: "reg",
    component: Reg,
  },

  {
    path: "/cwa",
    name: "cwa",
    component: CWA,
  },
  {
    path: "/work",
    name: "work",
    component: Work,
  },
  {
    path: "/info",
    name: "userCenter",
    component: defineAsyncComponent(userInfo),
    meta: {
      title: "个人中心",
    },
  },
  {
    path: "/forgotPsd",
    name: "modifyPsd",
    component: ModifyPsd,
  },
  {
    path: "/cifaExamTrends",
    name: "examTrends",
    component: defineAsyncComponent(cifaExamTrends),
    meta: {
      title: "考试动态",
    },
  },
  {
    path: "/cawList/:type",
    name: "cwaExamTrends",
    component: defineAsyncComponent(cwaExamTrends),
    meta: {
      title: "考试动态",
    },
  },

  {
    path: "/articleDetails",
    name: "articleDetails",
    component: defineAsyncComponent(articleDetails),
    meta: {
      title: "文章详情",
    },
  },
  {
    path: "/cwaExam",
    name: "cwaExam",
    component: defineAsyncComponent(cwaExam),
    meta: {
      title: "CWA考试管理",
    },
  },
  {
    path: "/cifaExam",
    name: "cifaExam",
    component: defineAsyncComponent(cifaExam),
    meta: {
      title: "CIFA考试管理",
    },
  },
  {
    path: "/newItem/:id/",
    name: "newItem",
    component: NewDetailsVue,
  },
  {
    path: "/studyItem/:id",
    name: "studyItem",
    component: StudyDetailsVue,
  },

  {
    path: "/cifaItem/:id",
    name: "cifaItem",
    component: CIFADetailsVue,
    
  },
  {
    path: "/cwaItem/:id/:type",
    name: "cwaItem",
    component: CWADetailsVue,
    
  },
  {
    path: "/broadcast",
    name: "broadcast",
    component: Broadcast,
    meta: {
      title: "公告",
    },
  },
  {
    path: "/broadcastItem/:id",
    name: "broadcastItem",
    component: BroadcastItem,
    meta: {
      title: "公告详情",
    },
  },
  
  {
    path: "/search",
    name: "search",
    component: SearchVue,
    meta: {
      title: "搜索",
    },
  },

  {
    path: "/searchTitle",
    name: "searchTitle",
    component: SearchTitleVue,
  },

  {
    path: "/adminPrint",
    name: "adminPrint",
    component: AdminPrint,
    meta: {
      title: "打印准考证",
      showPrint: true
    },
  },{
    path: "/studyForm",
    name: "studyForm",
    component: defineAsyncComponent(studyForm),
    meta: {
      title: "表单提交",
    },
  },
  
  

];

const router = createRouter({
  history: createWebHashHistory(),
  routes: [...routes],
});

export default router;
